﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YmtAuth.Domain.Model.Token
{
    public class TokenSource
    {
        /// <summary>
        /// Token来源，Pc
        /// </summary>
        public const string PC = "pc";

        /// <summary>
        /// Token来源，Pc
        /// </summary>
        public const string MAINSITE = "mainsite";

        /// <summary>
        /// Token来源，App
        /// </summary>
        public const string APP = "app";

        /// <summary>
        /// Token来源，Wap
        /// </summary>
        public const string WAP = "wap";

        /// <summary>
        /// Token来源，SellerApp
        /// </summary>
        public const string SELLERAPP = "sellerapp";

        /// <summary>
        /// Token来源，SellerPc
        /// </summary>
        public const string SELLERPC = "sellerpc";

        /// <summary>
        /// 是否使用新的token格式解析token，目前仅支持app, wap
        /// </summary>
        /// <param name="tokenSource"></param>
        /// <returns></returns>
        public static bool IsApplyTokenSource(string tokenSource)
        {
            if (APP.Equals(tokenSource, StringComparison.InvariantCultureIgnoreCase)
                || WAP.Equals(tokenSource, StringComparison.InvariantCultureIgnoreCase)
                || PC.Equals(tokenSource, StringComparison.InvariantCultureIgnoreCase)
                || SELLERAPP.Equals(tokenSource, StringComparison.InvariantCultureIgnoreCase)
                || SELLERPC.Equals(tokenSource, StringComparison.InvariantCultureIgnoreCase))
                return true;
            else
                return false;
        }
    }
}
